# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, İşbaran Akçayır
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#

from PyQt4 import QtCore, QtGui
import asyncore, async_client
from phglobals import URLS
import sys, locale
from gettext import translation
from denemetrayicon import *

# locale.setlocale(locale.LC_ALL, "C")
_ = translation('pardushaber', fallback=True).ugettext

def translateUi(ui):
    print u"translater"
#    ui.label.setText(_("Keyword:"))


def main():

    """
    app = QtGui.QApplication(sys.argv)
    app.setOrganizationName("pardushaber")
    app.setApplicationName("pardushaber")

    if( QtGui.QSystemTrayIcon.isSystemTrayAvailable() != 1 ):
        message = QtGui.QMessageBox(self)
        message.setText(u'Could not detect system tray')
        message.setWindowTitle(u'Pardus Haber')
        message.setIcon(QtGui.QMessageBox.Warning)
        message.addButton("Quit", QtGui.QMessageBox.RejectRole)
        message.exec_()
        response = message.clickedButton().text()

        if response == "Quit":
            sys.exit()

    else:
        print u"System Tray available, application starting.."
        settings = QtCore.QSettings()
        settings.setValue("popupmessages", QtCore.QVariant(QtGui.QSystemTrayIcon.supportsMessages()))

        #app.setQuitOnLastWindowClosed(0)
    myob = TrayBase()
    """

    manager = async_client.connection_manager()
    for url in URLS:
        manager.request(url, async_client.consumer())
    while manager.poll(1):
        pass


    #translateUi(ui)
    #ui.show()

    #sys.exit(app.exec_())


if __name__ == "__main__":
    main()
